import { post, post4Data, get4Data } from './api'

function getUserInfo(params, cb) {
  return post('/user/info', params, cb)
}
function getUserId(params, cb) {
  return post('/weibo/userid', params, cb)
}
function login(params, cb) {
  return post4Data('/login', params, cb)
}
function logout(params, cb) {
  return get4Data('/login/out?target=' + params.jumpLink, params, cb)
}
function getMediaDataToServer(params, cb) {
  //https://apib.hd.xxx.com/v1/file/list?page=1&pageSize=20
  return post('/file/list', params, cb)
}
function deleteMediaList(params, cb) {
  //https://apib.hd.xxx.com/v1/file/del
  return post('/file/del', params, cb)
}
function getMyLists(params, cb) {
  //2.地址: https://apib.hd.xxx.com/v1/site/mylist
  return post('/site/mylist', params, cb)
}
function saveImgToServer(params, cb) {
  //https://apib.hd.xxx.com/v1/file/save
  return post('/file/save', params, cb)
}
function getTelCode(params, cb) {
  return post4Data('/sms', params, cb)
}
function regist(params, cb) {
  return post4Data('/user/reg', params, cb)
}
function getSiteDataToServer(params: IGetTempSiteData, cb: Function) {
  return post('/site/get', params, cb)
}
function onlineSite(params, cb) {
  return post4Data('/site/online', params, cb)
}
function deleteSite(params, cb) {
  return post4Data('/site/del', params, cb)
}
function getTempPreviewUrl(params, cb) {
  //https://apib.hd.xxx.com/v1/site/preshow?site_id=103
  return post('/site/preshow', params, cb)
}
//https://apib.hd.xxx.com/v1/feinit/share?url=xxxxxxx

//https://apib.hd.xxx.com/v1/weibo/userid
function getDataAll(params, cb) {
  return post4Data('/site/mydata', params, cb)
}
function getNavPrev(params, cb) {
  return post4Data('/stat/NavPrev', params, cb)
}
function exportDataTotal(params: IWebExportDataTotal, cb) {
  // 1.https://apib.hd.xxx.com/v1/stat/expdatatotal
  return post('/stat/expdatatotal', params, cb)
}
function exportData(params, cb) {
  return post('/stat/expdata', params, cb)
}
function recoverSiteQrcode(params, cb) {
  ///v1/site/qrcoderefresh?site_id=1
  return post('/site/qrcoderefresh', params, cb)
}
function getClickStatics(params: IWebUpdateClickStatics, cb) {
  // /v1/stat/clickmap?site_id=396&num=7
  //clickmap接口,,num为7天内的数据,,前台那给个下拉,选择1,3,7,如果没设置num就是截止目前所有的点击
  return post('/stat/clickmap', params, cb)
}
function setTemp(params, cb) {
  return post('/site/cpto', params, cb)
}
function getTempLists(params, cb) {
  return post('/site/tmpllist', params, cb)
}
function getFormDataTable(params: IWebGetFormDataTable, cb: any) {
  //https://apib.hd.xxx.com/V1/stat/formlist
  return post('/stat/formlist', params, cb)
}
function getPromtLists(params, cb) {
  return post('/stat/promt_list', params, cb)
}
function addPromt(params, cb) {
  return post('/stat/promt_add', params, cb)
}
function markFormItem(params: IWebDeleteFormItem, cb: any) {
  // https://apib.hd.xxx.com/v1/stat/formdel?site_id=2484&id=31320                软删除,del=-1
  return post('/stat/formdel', params, cb)
}
function deleteFormItem(params: IWebDeleteFormItem, cb: any) {
  params.operate = 'real'
  // https://apib.hd.xxx.com/v1/stat/formdel?site_id=2484&id=31320&operate=real   物理删除
  return post('/stat/formdel', params, cb)
}
function getDictionaryTree(params, cb) {
  return post('/dictionary/tree', params, cb)
}
function getMySite4Data(params, cb) {
  return post('/site/mysite', params, cb)
}
function getPromtDay(params, cb) {
  return post('/stat/promt_day', params, cb)
}
function resetPassword(params, cb) {
  return post4Data('/login/reset', params, cb)
}
function addTag(params: IWebDeleteTag, cb: any) {
  return post4Data('/site/addSiteTag', params, cb)
}
function deleteTag(params: IWebDeleteTag, cb: any) {
  return post4Data('/site/delSiteTag', params, cb)
}
function getSearchTagList(params, cb) {
  return post4Data('/tag/list', params, cb)
}

function getTaglist(params, cb) {
  return post4Data('/site/getTaglist', params, cb)
}

export {
  getUserInfo,
  getUserId,
  login,
  logout,
  getMediaDataToServer,
  deleteMediaList,
  getMyLists,
  saveImgToServer,
  getTelCode,
  regist,
  getSiteDataToServer,
  onlineSite,
  deleteSite,
  getTempPreviewUrl,
  getDataAll,
  getNavPrev,
  exportDataTotal,
  exportData,
  recoverSiteQrcode,
  getClickStatics,
  setTemp,
  getTempLists,
  getPromtLists,
  addPromt,
  markFormItem,
  deleteFormItem,
  getDictionaryTree,
  getPromtDay,
  addTag,
  deleteTag,
  getSearchTagList,
  getTaglist,
  resetPassword,
  getMySite4Data,
  getFormDataTable
}